﻿<UserControl x:Class="ProgrammersCalculator.View.HashAlgorithms"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:conv="clr-namespace:ProgrammersCalculator.Convertor"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="300">
    <UserControl.Resources>
        <conv:HashConvertor x:Key="HashConvertor"></conv:HashConvertor>
        <conv:ExpanderToBooleanConverter x:Key="ExpanderToBooleanConverter"></conv:ExpanderToBooleanConverter>
    </UserControl.Resources>


    <DockPanel>
        <Border DockPanel.Dock="Top"
                Style="{DynamicResource styleContentArea}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <!-- HEADER -->
                <Border Grid.Row="0"
                        Style="{DynamicResource styleContentAreaHeader}">
                    <Grid>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock FontSize="20"
                                       Padding="8"
                                       VerticalAlignment="Center">Hash Algorithms</TextBlock>
                        </StackPanel>
                    </Grid>
                </Border>

                <!--CONTENT AREA-->
                <Grid x:Name="LayoutRoot"
                      Grid.Row="1">
                    <Border Margin="4"
                            BorderThickness="1,1,1,1"
                            CornerRadius="8,8,8,8">
                        <StackPanel x:Name="ContentStackPanel"
                                    Margin="20">
                            <StackPanel Margin="0">
                                <Expander Header="String to MD5"
                                          FontFamily="Verdana"
                                          IsExpanded="{Binding SelectedExpander, Mode=TwoWay, Converter={StaticResource ExpanderToBooleanConverter}, ConverterParameter=1}">
                                    <StackPanel Margin="10,4,0,0">
                                        <TextBlock Text="Enter  String"></TextBlock>
                                        <TextBox TextWrapping="Wrap"
                                                 VerticalAlignment="Top"
                                                 VerticalScrollBarVisibility="Visible"
                                                 AcceptsReturn="True"
                                                 Height="100"
                                                 Name="txtInput" />
                                        <Border CornerRadius="10"
                                                Background="#FFF9F7F7"
                                                Height="5"></Border>
                                        <TextBox TextWrapping="Wrap"
                                                 VerticalScrollBarVisibility="Auto"
                                                 Text="{Binding ElementName=txtInput,Path=Text,Converter={StaticResource HashConvertor},ConverterParameter=md5}"
                                                 AcceptsReturn="True"
                                                 Name="txtMd5"
                                                 CaretIndex="1"
                                                 FontFamily="Arial Unicode MS" />
                                    </StackPanel>
                                </Expander>

                                <Expander Header="String to SHA1"
                                          FontFamily="Verdana"
                                          IsExpanded="{Binding SelectedExpander, Mode=TwoWay, Converter={StaticResource ExpanderToBooleanConverter}, ConverterParameter=2}">
                                    <StackPanel Margin="10,4,0,0">
                                        <TextBlock Text="Enter  String"></TextBlock>
                                        <TextBox TextWrapping="Wrap"
                                                 VerticalAlignment="Top"
                                                 VerticalScrollBarVisibility="Visible"
                                                 AcceptsReturn="True"
                                                 Height="100"
                                                 Name="txtStringSHA" />
                                        <Border CornerRadius="10"
                                                Background="#FFF9F7F7"
                                                Height="5"></Border>
                                        <TextBox TextWrapping="Wrap"
                                                 VerticalScrollBarVisibility="Auto"
                                                 Text="{Binding ElementName=txtStringSHA,Path=Text,Converter={StaticResource HashConvertor},ConverterParameter=sha1}"
                                                 AcceptsReturn="True"
                                                 Name="txtSHA1"
                                                 CaretIndex="1"
                                                 FontFamily="Arial Unicode MS" />
                                    </StackPanel>
                                </Expander>

                                <Expander Header="String to SHA256"
                                          FontFamily="Verdana"
                                          IsExpanded="{Binding SelectedExpander, Mode=TwoWay, Converter={StaticResource ExpanderToBooleanConverter}, ConverterParameter=3}">
                                    <StackPanel Margin="10,4,0,0">
                                        <TextBlock Text="Enter  String"></TextBlock>
                                        <TextBox TextWrapping="Wrap"
                                                 VerticalAlignment="Top"
                                                 VerticalScrollBarVisibility="Visible"
                                                 Height="100"
                                                 AcceptsReturn="True"
                                                 Name="txtStringSHA256" />
                                        <Border CornerRadius="10"
                                                Background="#FFF9F7F7"
                                                Height="5"></Border>
                                        <TextBox TextWrapping="Wrap"
                                                 VerticalScrollBarVisibility="Auto"
                                                 Text="{Binding ElementName=txtStringSHA256,Path=Text,Converter={StaticResource HashConvertor},ConverterParameter=sha256}"
                                                 AcceptsReturn="True"
                                                 Name="txtSHA256"
                                                 CaretIndex="1"
                                                 FontFamily="Arial Unicode MS" />
                                    </StackPanel>
                                </Expander>

                                <Expander Header="String to SHA512"
                                          FontFamily="Verdana"
                                          IsExpanded="{Binding SelectedExpander, Mode=TwoWay, Converter={StaticResource ExpanderToBooleanConverter}, ConverterParameter=4}">
                                    <StackPanel Margin="10,4,0,0">
                                        <TextBlock Text="Enter  String"></TextBlock>
                                        <TextBox TextWrapping="Wrap"
                                                 VerticalAlignment="Top"
                                                 VerticalScrollBarVisibility="Visible"
                                                 AcceptsReturn="True"
                                                 Height="100"
                                                 Name="txtStringSHA512" />
                                        <Border CornerRadius="10"
                                                Background="#FFF9F7F7"
                                                Height="5"></Border>
                                        <TextBox TextWrapping="Wrap"
                                                 VerticalScrollBarVisibility="Auto"
                                                 Text="{Binding ElementName=txtStringSHA512,Path=Text,Converter={StaticResource HashConvertor},ConverterParameter=sha512}"
                                                 AcceptsReturn="True"
                                                 Name="txtSHA512"
                                                 CaretIndex="1"
                                                 FontFamily="Arial Unicode MS" />
                                    </StackPanel>
                                </Expander>

                            </StackPanel>
                        </StackPanel>
                    </Border>
                </Grid>
            </Grid>
        </Border>
    </DockPanel>

</UserControl>
